package pers.archives.common.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import pers.archives.common.exception.UserNotLogin;
import pers.archives.common.ov.common.CommonResponse;
import pers.archives.common.ov.common.ResponseCode;

/* 统一异常拦截类
 *@program:archives-parent
 *@author: 赵浩浩
 *@Time: 2020/9/17  16:43
 */
@Slf4j
@RestControllerAdvice
public class CommonExceptionHandler {
    /**
     * 定义通用的异常拦截 1.0
     */

    /**
     * 没有找到登录信息处理类
     * @return
     */
    @ExceptionHandler(UserNotLogin.class)
    public CommonResponse<Object> userNotFoundHandler() {
        return new CommonResponse<Object>(ResponseCode.USER_NOT_LOGIN, "请登录");
    }

}
